package com.huike.web.controller.rule;

import com.huike.clues.domain.TbRulePool;
import com.huike.clues.domain.dto.TbRulePoolDTO;
import com.huike.clues.service.TbRulePoolService;
import com.huike.common.result.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description 线索或商机池规则相关接口
 * @Date 2023-10-10
 */
@Slf4j
@Api("修改线索池规则模块")
@RestController
@RequestMapping("/rule/pool")
public class TbRulePoolController {
    @Resource
    private TbRulePoolService tbRulePoolService;

    /**
     * 数据回显
     * @param id
     * @return
     */
    @GetMapping("{type}")
    public Result<TbRulePoolDTO> selectRuleById(@PathVariable("type") Long id){
        log.info("数据回显");
        TbRulePoolDTO tbRulePool = tbRulePoolService.selectRuleById(id);
      return Result.success(tbRulePool);
    }


    /**
     * 修改线索池或商机池规则
     * @param tbRulePoolDTO
     * @return
     */
    @PutMapping()
    public Result setPool(@RequestBody TbRulePoolDTO tbRulePoolDTO) {
        tbRulePoolService.putpool(tbRulePoolDTO);
    return Result.success();
    }
}
